<?php

use yii\db\Migration;

/**
 * Handles the creation for table `htf_hospital`.
 */
class m160509_021916_create_htf_hospital extends Migration
{
<<<<<<< HEAD
    const TBL_NAME = '{{%doctor}}';
=======
    const TBL_NAME = '{{%hospital}}';
>>>>>>> master
    /**
     * @inheritdoc
     */
    public function up()
    {
        $sql = "
            DROP TABLE IF EXISTS ". self::TBL_NAME .";
            CREATE TABLE ". self::TBL_NAME ." (
                `id`  int NOT NULL ,
                `u_id`  int NULL COMMENT '关联用户id' ,
                `name`  varchar(50) NOT NULL COMMENT '医生真实姓名' ,
                `head_pic`  varchar(255) NULL DEFAULT NULL COMMENT '医院图标' ,
                `live_pic`  varchar(255) NULL DEFAULT NULL COMMENT '医疗环境' ,
                `introduce`  text NULL COMMENT '医院介绍' ,
                `credentials`  varchar(255) NULL DEFAULT NULL COMMENT '医院资质' ,
                `phone`  varchar(255) NULL DEFAULT NULL COMMENT '医院固定电话' ,
                `address`  varchar(255) NULL DEFAULT NULL COMMENT '地址' ,
                `pre_fee`  varchar(255) NULL DEFAULT NULL COMMENT '预约植发费用' ,
                `total_fee`  varchar(255) NULL DEFAULT NULL COMMENT '全额植发费用(每个毛囊单价)' ,
                `alipay`  varchar(255) NULL DEFAULT NULL COMMENT '支付宝账号' ,
                `status`  tinyint NOT NULL DEFAULT 0 COMMENT '待审核(0) 通过审核(1) 未通过审核()' ,
                `score`  smallint(6) NOT NULL DEFAULT 0 COMMENT '评分' ,
                `booking_times`  int(11) NOT NULL DEFAULT 0 COMMENT '预约次数' ,
                `follow_numbers`  int(11) NOT NULL DEFAULT 0 COMMENT '关注者人数' ,
                PRIMARY KEY (`id`),
                INDEX `u_id` (`u_id`)
                )
        ";
        $this->execute($sql);
    }

    /**
     * @inheritdoc
     */
    public function down()
    {
        $this->dropTable('htf_hospital');
    }
}
